//~
var arr = [1,2,3,'1','1x','a','',true,false,NaN];
arr.forEach(function(item){
	console.log(item,~item);
});
/* output:
1 -2
2 -3
3 -4
1 -2
1x -1
a -1
 -1
true -2
false -1
NaN -1
*/


// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators
// ~ bitwise not
// ~ will operator on a number
// it looks like:
// ~foo = 
// if foo not number ,convert to number
// if cannot convert to number, use 0
